package wm.samsung.main;

import wm.samsung.main.R;
import wm.samsung.persistence.DataBaseHelper;

import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.database.SQLException;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class modeloActivity extends Activity {

	private EditText modelo;
	private Button continuar;

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.modelo);
		modelo = (EditText) findViewById(R.id.modelotext);
		continuar = (Button) findViewById(R.id.btnContinuar);
		continuar.setOnClickListener(new Button.OnClickListener() {
			public void onClick(View v) {
				Intent i = new Intent(getBaseContext(), imagenActivity.class);
				startActivity(i);
			}
		});
		DataBaseHelper myDbHelper;
		myDbHelper = new DataBaseHelper(this);
		try {

			myDbHelper.openDataBase();

		} catch (SQLException sqle) {

			throw sqle;

		}
		Cursor cursor = myDbHelper.getModels();
		if (cursor.moveToFirst() && modelo != null) {
			modelo.setText(cursor.getString(0));
		}
	}
}
